 import request from '@/utils/https'
import request2 from '@/utils/exportHttps'
import request3 from '@/utils/https2'
// import qs from 'qs'

export function pageList (data) {
  return request({
    url: '/cateringCompany/pageList',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

export function num (data) {
  // const params = qs.stringify(data)
  return request({
    url: '/cateringCompany/num',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

export function areaDict (params) {
  return request({
    url: '/dictionary/areaDict',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    params
  })
}

export function equipmentInfoNum (data) {
  // const params = qs.stringify(data)
  return request({
    url: '/equipmentInfo/num',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

export function equipmentPageList (data) {
  return request({
    url: '/equipmentInfo/pageList',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}



export function outLineList (data) {
  return request({
    url: '/equipmentInfo/outLineList',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}


export function cleaningRecordData (data) {
  return request({
    url: '/cleaningRecord/cleaningRecordData',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

// 报警统计分析
export function warnStatistics (data) {
  return request({
    url: '/equipmentInfo/warnStatistics',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

// 临期清洗提醒
export function cleaningRecordWarn (data) {
  return request({
    url: '/cleaningRecord/cleaningRecordWarn',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

// 超期未清洗报警
export function noCleaningRecordOver (data) {
  return request({
    url: '/cleaningRecord/noCleaningRecordOver',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}
// 违规报警记录
export function warnPageList (data) {
  return request({
    url: '/equipmentInfo/warnPageList',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

export function restaurantSprinkle (data) {
  return request({
    url: '/cateringCompany/restaurantSprinkle',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

// 查看企业详情
export function companyDetail (params) {
  return request({
    url: '/cateringCompany/detail',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    params
  })
}

// 正常清洗记录 & 超期清洗记录
export function cleaningRecord (data) {
  return request({
    url: '/cleaningRecord/cleaningRecord',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

// 折线图
// export function realTimeData (data) {
//   return request({
//     url: '/equipmentInfo/realTimeDataNew',
//     method: 'post',
//     headers: {
//       'Content-Type': 'application/x-www-form-urlencoded'
//     },
//     data
//   })
// }

export function realTimeDataRecord (data) {
  return request({
    url: '/equipmentInfo/realTimeData',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

export function list (params) {
  return request({
    url: '/dictionary/list',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    params
  })
}

export function smokeAlarmPageList (params) {
  return request({
    url: '/equipmentInfo/smokeAlarmPageList',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}
export function fiveMinutesGasConcentration (params) {
  return request({
    url: '/equipmentInfo/fiveMinutesGasConcentration',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function twoHoursGasConcentration(params) {
  //  console.log('Signal passed to request:', signal); // 调试点
  return request({
    url: '/equipmentInfo/twoHoursGasConcentration',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params,
    // signal // 关键点：传入 AbortSignal
  })
}

export function workingGasConcentration (params) {
  return request({
    url: '/equipmentInfo/workingGasConcentration',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

// 油烟浓度报警
export function workingSmokeAlarmPageList (params) {
  return request({
    url: '/equipmentInfo/workingSmokeAlarmPageList',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

// 油烟浓度报警大屏右下角列表
export function smokeAlarm (params) {
  return request({
    url: '/equipmentInfo/smokeAlarm',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function cateringCompanyEquip (params) {
  return request({
    url: '/equipmentInfo/cateringCompanyEquip',
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: params
  })
}

export function recordList (params) {
  return request({
    url: '/cleaningRecord/recordList',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function equipmentInfoPageList (params) {
  return request({
    url: '/equipmentInfo/pageList',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function gasConcentrationMaxList (params) {
  return request({
    url: '/equipmentInfo/gasConcentrationMaxList',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function exportGasConcentrationMax (params) {
  return request2({
    url: '/equipmentInfo/exportGasConcentrationMax',
    method: 'GET',
    responseType: 'blob',
    params
  })
}

export function exportEquipmentWarn (params) {
  return request2({
    url: '/equipmentInfo/exportEquipmentWarn',
    method: 'GET',
    responseType: 'blob',
    params
  })
}

export function exportWorkingSmokeAlarm (params) {
  return request2({
    url: '/equipmentInfo/exportWorkingSmokeAlarm',
    method: 'GET',
    responseType: 'blob',
    params
  })
}

export function gasConcentrationMaxWarnList (params) {
  return request({
    url: '/equipmentInfo/gasConcentrationMaxWarnList',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function exportGasConcentrationMaxWarn (params) {
  return request2({
    url: '/equipmentInfo/exportGasConcentrationMaxWarn',
    method: 'GET',
    responseType: 'blob',
    params
  })
}

export function login (params) {
  return request({
    url: '/user/login',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function getIndex (params) {
  return request({
    url: '/cateringCompany/getIndex',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    params
  })
}

export function addUserLogin (params) {
  return request({
    url: '/user/addUserLogin',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}
export function getUserLogin (params) {
  return request({
    url: '/user/getUserLogin',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}
export function captcha (params) {
  return request3({
    url: '/user/captcha',
    method: 'GET',
    responseType: 'blob',
    params
  })
}
export function newLogin (params) {
  return request({
    url: '/user/newLogin',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}
export function updateEquipmentWarn (params) {
  return request({
    url: '/equipmentInfo/updateEquipmentWarn',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
}

export function exportApi (params) {
  return request2({
    url: '/export',
    method: 'GET',
    responseType: 'blob',
    params
  })
}